/*
============================================================================
Name        : CVersificatorView from VersificatorView.h
Author      : 
Version     :
Copyright   : Your copyright notice
Description : CVersificatorView implementation
============================================================================
*/

// INCLUDE FILES
#include  "VersificatorView.h"
#include "VersificatorContainer.h"

#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <Versificator.rsg>
#include "PluginUtility.h"


// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CVersificatorView::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CVersificatorView::ConstructL()
{
	BaseConstructL(R_VERSIFICATOR_VIEW);

	iContainer = new (ELeave) CVersificatorContainer(*((CVersificatorAppUi*)AppUi()));
	iContainer->SetMopParent(this);
	iContainer->ConstructL(AppUi()->ClientRect());
	AppUi()->AddToStackL( *this, iContainer );
}

// ---------------------------------------------------------
// CVersificatorView::~CVersificatorView()
// destructor
// ---------------------------------------------------------
//
CVersificatorView::~CVersificatorView()
{
	if (iContainer)
	{
		AppUi()->RemoveFromViewStack(*this, iContainer);
	}
	DELETE(iContainer);
}

// ---------------------------------------------------------
// TUid CVersificatorView::Id()
//
// ---------------------------------------------------------
//
TUid CVersificatorView::Id() const
{
	return KViewId;
}

// ---------------------------------------------------------
// CVersificatorView::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CVersificatorView::HandleCommandL(TInt aCommand)
{   
	AppUi()->HandleCommandL(aCommand);
}

// ---------------------------------------------------------
// CVersificatorView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CVersificatorView::HandleClientRectChange()
{
	if (iContainer)
	{
		iContainer->SetRect(AppUi()->ClientRect());
	}
}

// ---------------------------------------------------------
// CVersificatorView::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CVersificatorView::DoActivateL(
								 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
								 const TDesC8& /*aCustomMessage*/)
{
}

// ---------------------------------------------------------
// CVersificatorView::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CVersificatorView::DoDeactivate()
{
	if (iContainer)
	{
		AppUi()->RemoveFromViewStack(*this, iContainer);
	}
	DELETE(iContainer);
}

void CVersificatorView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
	AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
}
